package com.data.unityplugin_market.util

import android.content.Context
import io.reactivex.Observable
import io.reactivex.Observer
import io.reactivex.disposables.Disposable

public open class BaseObservable<T> : Observer<T> {

    var context : Context ? = null;

    constructor(context: Context) {
        this.context = context;
    }




    override fun onComplete() {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    override fun onSubscribe(d: Disposable) {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    override fun onNext(t: T) {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
        onSuccess(t)
    }

    override fun onError(e: Throwable) {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
        onFailure(e,true)
    }


    /**
     * 返回成功
     *
     * @param t
     * @throws Exception
     */

    fun onSuccess(t: T) {

    }

    /**
     * 返回失败
     */
     fun onFailure(e: Throwable, isNetWorkError: Boolean) {
    }

}